rm(list = ls())

## packages 

library(tidyverse)
library(fixest)

## Load data 

mig_back <- readRDS('data/mig_back.rds')  

corr <- cor(mig_back$mig_background, mig_back$foreign_non_eu_share)

p1 <- ggplot(mig_back, aes(x = mig_background, y = foreign_non_eu_share)) + 
  geom_point(shape = 21, fill = 'white') + 
  theme_bw() +
  stat_smooth(method = 'lm',
              col = 'black', se = F, linewidth = .4) + 
  geom_hline(yintercept = 0, linetype = 'dotted') + 
  labs(y = 'Non-EU foreigner share (%)',
       x = 'Share migration background (%)') +
  annotate("text", x = 64, y = 15, 
           label = paste("r = ", round(corr, 2)), 
           hjust = "right", vjust = "top",
           size = 5) +
  scale_x_continuous(breaks = seq(0, 60, 10), limits = c(0, 70)) + 
  scale_y_continuous(breaks = seq(0, 60, 10), limits = c(0, 20))


p1









